#include <iostream>
#include <vector>
#include <numeric>
#include <algorithm>

using namespace std;

// 3411. 最长乘积等价子数组
// https://leetcode.cn/problems/maximum-subarray-with-equal-products/description/

class Solution
{
    int gcd(int a, int b)
    {
        return b == 0 ? a : gcd(b, a % b);
    }

public:
    int maxLength(vector<int> &nums)
    {
        int left = 0;
        int n = nums.size();
        int mul = 1;
        int ans = 0;
        for (int right = 0; right < n; right++)
        {
            while (gcd(mul, nums[right]))
            {
                mul /= nums[left];
                left++;
            }
            mul *= nums[right];
            ans = max(ans, right - left + 1);
        }
        return ans;
    }
};

int main()
{
    return 0;
}